from pathlib import Path 
import pytest 
from config.settings import get_settings 


@pytest.fixture(scope='session', autouse=True)
def init(): 
    print('stata test')
    yield 
    set = get_settings()
    name = set.root / set.database_name 
    p = Path(__file__).parents[1] / name
    print(p)
    if p.exists(): 
        p.unlink()


@pytest.fixture(scope='module', autouse=True)
def init_db(): 

    yield 
    from data.database import create_curs 
    with create_curs() as curs: 
        curs.execute('delete from explorer')
        curs.execute('delete from creature')
